<%@ Page  Language="VB" MasterPageFile="~/Admin/admin.master" AutoEventWireup="false" CodeFile="PermissionsByType.aspx.vb" Inherits="Admin_PermissionsByType" title="Admin - Edit Role Communications" %>
<%@ Register Assembly="InputControls" Namespace="InputControls" TagPrefix="cc2" %>
<%@ Register Src="SubNavControls/RolePermissionsSubNavControl.ascx" TagName="RolePermissionsSubNavControl"
    TagPrefix="uc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<script language="javascript">
    function SelectAllCheckboxes(spanChk){

        var oItem = spanChk.children;
        var theBox = (spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];

        xState = theBox.checked;
        elm = theBox.form.elements;

        for(i=0;i<elm.length;i++)

            if(elm[i].type=="checkbox" && elm[i].id!=theBox.id) {

                if(elm[i].checked!=xState)
                    elm[i].click();

            }

    }
</script>
<uc1:RolePermissionsSubNavControl ID="RolePermissionsSubNavControl1" runat="server" />


    <table cellpadding="0" cellspacing="0">
       <tr><td width="20px"></td><td><a id="pageContent"><h1>Admin - Edit Role Communications</h1></a></td></tr>
       </table>
    <table cellpadding="0" cellspacing="0" border="0" width="900px">
       <tr><td style="width:20px;">&nbsp;</td>
           <td style="width:440px;" align="left"><asp:label ID="RoleLabel" runat="server" AssociatedControlID="RolesDropDownList" CssClass="adminSelectLabel" Text="Select Role:"></asp:label>
            <asp:DropDownList ID="RolesDropDownList" runat="server" CssClass="adminSelectForm" DataSourceID="RolesObjectDataSource" DataValueField="RoleId"
                DataTextField="RoleDisplayName" AutoPostBack="False">
            </asp:DropDownList>
              <asp:Button ID="SubmitRoleButton" runat="server" Text="Go" /></td>
       <td style="width:440px;" align="right"><asp:Label ID="CommunicationTypeLabel" runat="server" AssociatedControlID="PermissionTypesDropDownList" Text="Select Communication Type:" CssClass="adminSelectLabel"></asp:Label>
            <asp:DropDownList ID="PermissionTypesDropDownList" runat="server" CssClass="adminSelectForm" DataSourceID="PermissionTypesObjectDataSource" DataValueField="ClassName"
                DataTextField="DisplayName" AutoPostBack="False">
            </asp:DropDownList>
            <asp:Button ID="SubmitTypeButton" runat="server" Text="Go" /></td>
       </tr>
       <tr height="5px"><td colspan="3"></td></tr>
       <tr>
       <td colspan="3" align="center">
       <cc2:ScrollingGridView ID="PermissionsScrollingGridView" runat="server" ShowFooter=false CssClass="gridOffsetSmall" IsFixedColumn="true" CellPadding="5" ToolTip="175"  
            AutoGenerateColumns="False" DataSourceID="GridObjectDataSource" BorderColor="#21334B" BorderStyle="Solid" GridLines="Vertical" EmptyDataText="" AllowSorting="true">
            <HeaderStyle CssClass="adminHeaderStyle" BackColor="#C3CAD4" BorderColor="#21334B" VerticalAlign="Top" />
            <RowStyle CssClass="adminColumnStyle" />
            
            <Columns>
            <asp:BoundField HeaderText="Id" DataField="Id" HeaderStyle-Width="50px" ItemStyle-Width="44px" />
                <asp:TemplateField HeaderText="Subject" SortExpression="AdminDescription">
                     <ItemStyle Width="500px" />
                     <HeaderStyle Width="500px" />
                    <ItemTemplate><%#Eval("AdminDescription")%></ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Receives Communication?">
                     <HeaderStyle Width="305px" />
                    <ItemTemplate>
                        <asp:CheckBox runat="server" ID="HasPermissionCheckBox"  />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="275px" />
                    <HeaderTemplate>
                        Receives Communication?&nbsp;&nbsp;
                        <asp:CheckBox ID="SelectAllCheckBox" Text="(Set All)" TextAlign="Left" runat="server" onclick="javascript:SelectAllCheckboxes(this);"></asp:CheckBox>
                    </HeaderTemplate>
                </asp:TemplateField>
            </Columns>
            <AlternatingRowStyle BackColor="#E8ECF4" />
       </cc2:ScrollingGridView>
       </td>
       </tr></table>     
            
            
            <asp:ObjectDataSource ID="RolesObjectDataSource" runat="server" SelectMethod="ListActive" TypeName="Cdm.DataCore.UserSecurity.Role">
            </asp:ObjectDataSource>
            
            <asp:ObjectDataSource ID="PermissionTypesObjectDataSource" runat="server" SelectMethod="ListPermissionTypes"
                TypeName="Cdm.DataCore.LookupTables.LuAdminTableList"></asp:ObjectDataSource>
                
            <asp:ObjectDataSource ID="GridObjectDataSource" TypeName="Cdm.DataCore.CaseNotes.Notification" DataObjectTypeName="Cdm.DataCore.CaseNotes.Notification" SelectMethod="ListBySort" SortParameterName="sortExpr"  runat="server"></asp:ObjectDataSource>

</asp:Content>
<asp:Content ID="FixedContent" ContentPlaceHolderID="ContentPlaceHolderFixedAdmin" runat="server">
    <asp:Button ID="SaveButton" runat="server" Text="Save" />
    <asp:Button ID="ResetButton" runat="server" Text="Reset" />
</asp:Content>

